<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>

<div>

    <div style="margin-left: 250px">
        <div style="padding-top: 200px">
            <h2 style="color: #009f95">后台管理系统登入</h2>
            <div style="padding-top: 20px">
                <input class="layui-input" id="username" style="width: 250px;height: 30px" placeholder="请输入账号">
            </div>
            <div style="padding-top: 20px">
                <input type="password" id="password" class="layui-input" style="width: 250px;height: 30px" placeholder="请输入密码">
            </div>
            <div style="padding-top: 20px">
                <button class="layui-btn" id="dengru">登入</button>
            </div>
        </div>
    </div>
</div>
<script src="js/jquery.min.js"></script>
<script>
$("#dengru").click(function () {
    var username=$("#username").val();
    var password=$("#password").val();
    var data=urldata('post','/login',{'username':username,'password':password})
    location.href="page/main.html";
})

function urldata(requestObject,url,data) {
    var data1='';
    $.ajax({
        type: requestObject,
        url: url,
        data:data,
        async:false,
        success: function(data) {
            data1=data;
        }
    })
    return data1
}
</script>
</body>
</html>